
//发送ajax 请求函数



function initNotices(url)
{
    $.ajax({
        url:url,
        data:{},
        dataType:"json",
        type:"post",
        success:function(req)
        {
            var noticeDiv = document.querySelector("#noticeDiv");
            var lst = req.data;

            for (var i = 0;i<lst.length;i++)
            {
                var ele = lst[i];
                var noticeID = ele.noticeid;
                var div = document.createElement("div");
                div.setAttribute("noticeID",noticeID);
                var h3 = document.createElement("h4");
                h3.setAttribute("style","text-align:center;");
                h3.append(ele.noticeCaption);
                div.appendChild(h3);
                var h4 = document.createElement("h3");
                h4.append(ele.noticeContext);
                div.appendChild(h4);

                noticeDiv.appendChild(div);

            }
        }

    })
}


function initLabels(url)
{
    $.ajax({
        url:url,
        data:{},
        dataType:"json",
        type:"post",
        success:function(req)
        {

            var labelDiv = document.querySelector("#labelList");
            var lst = req.data;

            for (var i = 0;i<lst.length;i++)
            {
                var target = lst[i];
                var picname = target.pictureLabel;
                var color = target.color;
                var labelid = target.labelID;

                var div = document.createElement("div");
                if ("undefined" == typeof color)
                    color = "142,147,146";

                var style = "color:rgba(255,255,255,1.0);border-radius:3px;text-align:center;";

                var label = document.createElement("label");
                label.append(picname);
                label.setAttribute("labelID",labelid);
                div.appendChild(label);
                div.setAttribute("style",style+"background-color:rgba(" + color + ",1.0);");

                labelDiv.appendChild(div);
            }
        }
    })
}